package com.gite.nouette.admin.implementation.application.init;

import com.gite.nouette.admin.contract.application.init.IInitializerFactory;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryController;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryModel;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryService;
import com.gite.nouette.admin.contract.integrator.factory.IFactoryView;
import com.gite.nouette.admin.implementation.integrator.factory.FactoryControllerImpl;
import com.gite.nouette.admin.implementation.integrator.factory.FactoryModelImpl;
import com.gite.nouette.admin.implementation.integrator.factory.FactoryServiceImpl;
import com.gite.nouette.admin.implementation.integrator.factory.FactoryViewImpl;

public class InitializerFactoryImpl implements IInitializerFactory {
	private IFactoryService factoryService;
	private IFactoryModel factoryModel;
	private IFactoryView factoryView;
	private IFactoryController factoryController;

	public InitializerFactoryImpl() {
		init();
	}

	@Override
	public IFactoryService getFactoryService() {
		return factoryService;
	}

	public void setFactoryService(IFactoryService factoryService) {
		this.factoryService = factoryService;
	}

	@Override
	public IFactoryModel getFactoryModel() {
		return this.factoryModel;
	}

	public void setFactoryModel(IFactoryModel factoryModel) {
		this.factoryModel = factoryModel;
	}

	@Override
	public IFactoryView getFactoryView() {
		return this.factoryView;
	}

	public void setFactoryView(IFactoryView factoryView) {
		this.factoryView = factoryView;
	}

	@Override
	public IFactoryController getFactoryController() {
		return this.factoryController;
	}

	public void setFactoryController(IFactoryController factoryController) {
		this.factoryController = factoryController;
	}

	@Override
	public void init() {
		initFactoryService();
		initFactoryModel();
		initFactoryView();
		initFactoryController();
	}

	public void initFactoryService() {
		setFactoryService(new FactoryServiceImpl());
	}

	public void initFactoryModel() {
		FactoryModelImpl factoryModel = new FactoryModelImpl();
		factoryModel.setFactoryService(getFactoryService());
		setFactoryModel(factoryModel);
	}

	public void initFactoryView() {
		setFactoryView(new FactoryViewImpl());
	}

	public void initFactoryController() {
		IFactoryController factoryController = new FactoryControllerImpl();
		factoryController.setFactoryModel(getFactoryModel());
		factoryController.setFactoryView(getFactoryView());

		setFactoryController(factoryController);
	}
}
